import os from '@packages/lib-os';

const xcxNavigateTo = ({ url }) => {
    if (os.dyXcx) {
        window.tt?.miniProgram?.navigateTo({ url });
    } else if (os.xcx) {
        window.wx?.miniProgram?.navigateTo({ url });
    } else if (os.bdXcx) {
        window.swan?.webView?.navigateTo({ url });
    }
};

const xcxNavigateBack = (obj) => {
    if (os.dyXcx) {
        window.tt?.miniProgram?.navigateBack(obj);
    } else if (os.xcx) {
        window.wx?.miniProgram?.navigateBack(obj);
    } else if (os.bdXcx) {
        window.swan?.webView?.navigateBack(obj);
    }
};

export { xcxNavigateTo, xcxNavigateBack };
